import router from './'
// import useToken from '../stores/token'
import notification from '../utils/notification'
// import { ElStep } from 'element-plus/es/components/index.js'

// 白名单
const whiteList = ['/login']

router.beforeEach((to, from, next) => {
	document.title = to.meta.title + ' - ' + '后台管理系统'
	const token = localStorage.getItem('token')
	console.log('permission.js', token, to.path)
	if (token || whiteList.includes(to.path)) {
		next()
	} else {
		notification({
			message: '请先登录',
			type: 'error',
		})
		next('/login')
	}
})
